package cn.wit.summit.chwan.ui.base;

import android.support.v4.app.Fragment;

/**
 * Created by Alan on 2018/4/16.
 */

public class BaseFragment extends Fragment {

    public void showLoading(String s) {
        ((MyActivity)getActivity()).showLoading(s);
    }

    public void showLoading(String s, boolean b) {
        ((MyActivity)getActivity()).showLoading(s, b);
    }

    public void cancelLoading() {
        try {
            ((MyActivity)getActivity()).cancelLoading();
        } catch (Exception e) {

        }
    }

    public void cancelLoadingError() {
        ((MyActivity)getActivity()).cancelLoadingError();
    }

    public void cancelLoadingFinish() {
        ((MyActivity)getActivity()).cancelLoadingFinish();
    }

    public void cancelLoadingNetError() {
        ((MyActivity)getActivity()).cancelLoadingNetError();
    }

    public void showToast(String s) {
        try {
            if (getActivity()!=null)
                ((MyActivity)getActivity()).showToast(s);
        } catch (Exception e) {

        }
    }

    public void showToast(String s, int time) {
        try {
            if (getActivity()!=null)
                ((MyActivity)getActivity()).showToast(s, time);
        } catch (Exception e) {

        }
    }
}
